<!--Author: @ngel Sullon Macalupu-->
<? require_once '../../Include.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModScrum/Data/IteracionData.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModScrum/Data/Entity/Iteracion.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModScrum/Data/Enum/IteracionEstado.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModScrum/Data/Entity/Proyecto.php';
require_once '../../WEB_INF/SubmitConsulting/LiveScrum/ModConfig/Data/Entity/Usuario.php';
?>
<?
$go = trim($_POST['go']) ? trim($_POST['go']) : '';
$iteracionId = trim($_POST['iteracionId']) ? trim($_POST['iteracionId']) : '';
$d=new Iteracion();
if( $go=='Editar' ) {
	$tran= new IteracionData();
	$d=$tran->findByPk($iteracionId);
}
?>
<html>
    <head>
        <title>Main</title>
    <link type="text/css" rel="STYLESHEET" href="../../Recurso/Style/App.css">
    <script type="text/javascript" src="../../Recurso/Script/app.util.js" ></script>
    <script type="text/javascript" src="../../Recurso/Script/jquery.js" ></script>

<script type="text/javascript"
	src="../../Recurso/Script/jquery.datepick.js"></script>
<script type="text/javascript"
	src="../../Recurso/Script/jquery.datepick-es-PE.js"></script>
<link rel=stylesheet type="text/css"
	href="../../Recurso/Script/jquery.datepick.css">
<script type="text/javascript">
$(function() {
	$('#fechaInicio').datepick();
	$('#fechaTermino').datepick();
});
</script>

<script type='text/javascript' language='JavaScript'><!--
    function cancelar(){ document.fm2.submit(); }
    function enviar(){
        if( document.fm.rutaSprint.value==''){
            alert('Complete rutaSprint');
            document.fm.rutaSprints.select(); //focus()
            return false;
        }
        if(confirm('Esta seguro enviar?')) return true;
        else return false;
    }

    function eliminarConfirm() {
        if(confirm('Eliminar por completo?')){
            document.fm2.action='IteracionSave.php';
            document.fm2.go.value='Eliminar';
            document.fm2.submit();
        }
        else return false;
    }
    function sf(){ document.fm.rutaSprint.focus(); }
// --></script>
    </head>
    <body onload="sf()">
        <? require_once '../../Menu/Rol1/open.php'; ?>
        <? $itemTab = "2"; require_once '../../Menu/Rol1/menuSection.php'; ?>
        <div class="main">
            <div class="AlignLeft">
                <? $link = "l2"; require_once 'menuPlan.php'; ?>
            </div>
    	<div class='form'>

	<table class='TableForm' align='center'>
		<!-- head -->
		<tr class=TableFormTitle>
			<td colspan='3'>Formulario: Registro Iteracion
			</td>
		</tr>
		<tr class='legendIndication'>
			<td colspan='3' ><?= $go ?> Iteracion, por
				favor complete los datos con *. <br>Luego precione el
				bot&oacute;n <b><?= $go ?> </b> para guardar la informaci&oacute;n
				ingresada.&nbsp;</td>
		</tr>

		<!-- img upload -->
			<tr>
				<td rowspan='2' class='img' width='130' align='center'><//img
					src='../../Recurso/Foto/' width='120'
					height='140'> 
				</td>
				<td rowspan='2' style='width: 5px; vertical-align: top;'
					class='fonc'></td>
				<td colspan='1'></td>
			</tr>

		<!-- main -->
		<form action='IteracionSave.php' method='post' name='fm'
			onsubmit='return enviar()'>
			<input type='hidden' name='go' value='<?= $go ?>'> 
			<input type='hidden' name='iteracionId' value='<?= $iteracionId ?>'>
			<input type='hidden' name='proyectoId' value='<?= $_SESSION['proyectoId'] ?>'>
			<tr>
				<td valign='top'>
                        <table>
			<tr>
                            <td valign='top' colspan="2">
                                            <table>
							<tr>
								<td>RutaSprint: *</td>
								<td><input type='text' class='textEntry' name='rutaSprint'
									value='<?=$d->getRutaSprint()?>'></td>
							</tr>
							<tr>
								<td>FechaInicio:</td>
								<td><input type='text' class='dateEntry' name='fechaInicio' value='<?=$d->getFechaInicio()?>'
									id="fechaInicio" ></td>
							</tr>
							<tr>
								<td>FechaTermino:</td>
								<td><input type='text' class='dateEntry' name='fechaTermino' value='<?=$d->getFechaTermino()?>'
									id="fechaTermino" ></td>
							</tr>
							<tr>
								<td>Estado:</td>
								<td><select name="estado">
										<?
										foreach (IteracionEstado::$enum as $key => $value)
										{
											echo '<option value='.$key.''; if($key==$d->getEstado()) echo ' selected';
											echo '>';
											echo $value.' ('. $key .')';
											echo '</option>';
										}
										?>
								</select>
								</td>
							</tr>

						</table>
				</td>
                            </tr>
                             <tr>
                                 <td valign='top'>
					<fieldset>
						<legend>
							Objetivo
						</legend>

								<textarea name="objetivo" rows="6" cols="30" class='textareaEntry'><?=$d->getObjetivo()?></textarea>
                                            </fieldset>

				</td>
                                 <td valign='top'>
					<fieldset>
						<legend>
							Historia
						</legend>

                                            <textarea name="historia" rows="6" cols="30" class='textareaEntry'><?=$d->getHistoria()?></textarea>
                                       </fieldset>
				</td>
                            </tr>
                             <tr>
                                 <td valign='top' colspan="2">

					<fieldset>
						<legend>
							Retrospectiva
						</legend>

                                            <textarea name="retrospectiva" rows="12" cols="63" class='textareaEntry'><?=$d->getRetrospectiva()?></textarea>
                                       </fieldset>

				</td>
                            </tr>
                        </table>
				</td>
			</tr>


                            <TR class=TableFormFooter>
                                <TD colSpan=3 align="right">&nbsp;
                                    <input type='submit' class='Btn'
					value='<?= $go ?>'> <?php if( $go=='Editar' ) echo "<input type='button' class='Btn' value='Eliminar' onclick='eliminarConfirm();'>" ?>
					<input type='button' class='Btn' value='Cancelar'
					onclick='cancelar()'>

                                </TD></TR>
                            
		</form>
		<!-- end form fm (main Body)-->
	</table>

        </div>

    </div>
    <? require_once '../../Menu/Rol1/close.php'; ?>
    </body>
</html>

<form action='IteracionMain.php' method='post' name='fm2'>
	<input type='hidden' name='iteracionId' value='<?= $iteracionId ?>'> <input
		type='hidden' name='go' value=''>
</form>


